package com.corning.product.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.corning.product.entity.ShopAppraiseEntity;
import com.corning.product.service.ShopAppraiseService;
import com.corning.common.utils.PageUtils;
import com.corning.common.utils.R;



/**
 * 
 *
 * @author wtt
 * @email 1239115389@qq.com
 * @date 2022-03-20 15:07:32
 */
@RestController
@RequestMapping("product/shopappraise")
public class ShopAppraiseController {
    @Autowired
    private ShopAppraiseService shopAppraiseService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = shopAppraiseService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{apprId}")

    public R info(@PathVariable("apprId") Integer apprId){
		ShopAppraiseEntity shopAppraise = shopAppraiseService.getById(apprId);

        return R.ok().put("shopAppraise", shopAppraise);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody ShopAppraiseEntity shopAppraise){
		shopAppraiseService.save(shopAppraise);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ShopAppraiseEntity shopAppraise){
		shopAppraiseService.updateById(shopAppraise);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Integer[] apprIds){
		shopAppraiseService.removeByIds(Arrays.asList(apprIds));

        return R.ok();
    }

}
